Test-Series - programming logic

Test Number 2/15

Q: public class main {
{
int $ = 5;
}
}
A. Symbol not found error
B. Compile error
C. Runtime error
D. Nothing will print
Solution: Nothing will be displayed on the screen.

The correct answer is:
Nothing will print
Q: #include < stdio.h >
int main(){
int i=1;
for( , i<=10, i++){
if(i<5)
continue;
else
break;

print("hello_world");
}return 0;

}
A. 0 times
B. 11 times
C. 10 times
D. Infinite times
Solution: The correct answer is:
0 times
Q: #include < stdio.h >

int main()
{
union var{int a,b;};
union var v;v.a=10;v.b=20;
printf("%d
",v.a);
return 0;
}
A. 10
B. 20
C. 30
D. 40
Solution: The correct answer is 20
Q: Look at the pseudo-code below. How many times does the while loop gets executed if the following function is called as f(150,10)?

f(m.n)
{
   ans:=1
   while (m-n>=0)
   }
    ans:=ans*2m:=m-n
}
return (ans)
}
A. 10
B. 15
C. 20
D. 25
Solution: The correct answer is 15
Q: Which among the following is a server-based paradigm?
A. Cloud Computing
B. Data Validation Routine
C. Total Cost Of Ownership(TCO)
D. Request for Information(RFI)
Solution: Cloud computing paradigms can be classified as forms of 'anything as a service' (XaaS): 

SaaS
PaaS
IaaS.
The physical resources that cater to these services include servers for computing and storage, as well as network equipment.
The correct answer is:
Cloud Computing
Q: Which of the following options best suits for ‘Memory Leak Occurred
A. Occurs due to address assignment failure.
B. Program does not free the memory which is allocated dynamically
C. Program releases resources allocated in the memory
D. Resource allocation pending while debugging the code
Solution: The correct answer is "Program does not free the memory which is allocated dynamically". 

The memory leak occurs when a piece of memory was previously allocated by the programmer. Then it is not deallocated properly by the programmer. That memory is no longer in use by the program

The correct answer is:
Program does not free the memory which is allocated dynamically
Q: When we declare constant pointer to integer, we CANNOT change:
A. address in pointer variable
B. changes are not permitted
C. Value pointed by the pointer
D. either address in pointer variable or value at that address
Solution: A constant pointer in C cannot change the address of the variable to which it is pointing, i.e., the address will remain constant. 

The correct answer is:
changes are not permitted
Q: Find Prefix and suffix for the below infix problem statement :

Infix Expression : 11 +20/5*(20-15)^6^5
A. Prefix Expression: +11/20*5^^-20 15 6 5 Postfix Expression : 11 20 5 20 15 -6 5^^/+
B. Prefix Expression: 11 20 5 20 15-6 5^^*/+ Postfix Expression: +11/20 *5^^ -20 15 6 5
C. Prefix Expression: 11 20 15 20 5 - ^^*6 5/+ Postfix Expression: +20/11*5-20^^15 6 5
D. Prefix Expression: 11 20 5 20 15 - ^^^/+6 5 Postfix Expression: +11/^^-20*5 20 15 6 5
Solution: The correct answer is:
Prefix Expression: +11/20*5^^-20 15 6 5
 Postfix Expression : 11 20 5 20 15 -6 5^^/+
Q: The data type in C that occupies the least storage size is
A. char
B. double
C. float
D. int
Solution: Storage size in C Programming
Type	Storage Size	Value Range
 float	 4 byte	 1.2E-38 to 3.4E+38
char	1 byte	-128 to 127 or 0 to 255
int	2 or 4 bytes	-32,768 to 32,767 or -2,147,483,648 to 2,147,483,647

The correct answer is:
char

You Have Score    /9